﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ActivitiesControl.Domain.Services;
using System.Reflection;
using System.Configuration;
using ActivitiesControl.Domain.DAL;

namespace ActivitiesControl.Domain.Utils
{
	/// <summary>
	/// This class is responsible for instantiating the repository implementation.
	/// </summary>
	internal class Assembler
	{
		internal static IRepositoryProvider GetRepositoryProvider()
		{
			string assembly = ConfigurationManager.AppSettings["activities-assembly"];
			
			string type = ConfigurationManager.AppSettings["activities-repository_provider"];
			
			return Assembly
				.Load(assembly)
				.CreateInstance(type) as IRepositoryProvider;
		}
	}
}
